<?php 
include "./include/conf.php";
header('Content-Type: text/json');
$selectnotif = $pdo->prepare('select DATE_FORMAT(i.date,"%d-%m-%Y")as date,concat(a.prenom," ",a.nom) as auteur,i.id_information as id,"information" as type from information i,adherent a where i.en_attente = 1 and a.id_adherent = i.auteur
							  UNION
							  select DATE_FORMAT(c.date,"%d-%m-%Y") as date,concat(a.prenom," ",a.nom) as auteur,c.id_commentaire as id,"commentaire" as type from commentaire c,adherent a where c.en_attente = 1 and a.id_adherent = c.auteur
							  UNION
							  select DATE_FORMAT(date_demande,"%d-%m-%Y") as date,concat(prenom," ",nom) as auteur,id_adherent as id,"inscription" as type from adherent where en_attente = 1
							  order by date;	
							');
$selectnotif->execute();
$tab_notification = array();
while($notif = $selectnotif->fetch()){
	$tab_notification[] = $notif;	
}
echo json_encode($tab_notification);
?>